//
//  TF1to16ExpressionCell.swift
//  TalkfunSDKDemo
//
//  Created by 莫瑞权 on 2022/5/6.
//  Copyright © 2022 Talkfun. All rights reserved.
//

import UIKit
typealias TF1to16ExpressionCellmyBlock = (_ msg:String) -> Void

class TF1to16ExpressionCell: UICollectionViewCell {
    @objc public let imageButton = UIButton()
    @objc public var myBlock:TF1to16ExpressionCellmyBlock?
    @objc public var imageName:String = ""//表情名字

    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        self.addSubview(self.imageButton)
        self.imageButton.addTarget(self, action: #selector(self.btnClick), for: .touchUpInside)
        
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func layoutSubviews() {
        super.layoutSubviews()
        self.imageButton.frame = self.bounds
    }
    @objc func btnClick()
    {
        if (self.myBlock != nil&&self.imageName.count>0) {
            let name = "[" + self.imageName + "]"
           
            self.myBlock!(name);
        }
    }
   
}
